/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is Mozilla Communicator client code, released
 * March 31, 1998.
 *
 * The Initial Developer of the Original Code is
 * Netscape Communications Corporation.
 * Portions created by the Initial Developer are Copyright (C) 1998-1999
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *   Daniel Veditz <dveditz@netscape.com>
 *   Jeroen Dobbelaere <jeroen.dobbelaere@acunia.com>
 *
 *   Lan Qiang <jameslan@gmail.com>
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK *****
 */

#ifndef zipformat_h__
#define zipformat_h__

#pragma pack(push, 1)

struct ZipCentralEnd
{
	PRUint32                 signature;
	PRUint16                 disk_nr;
	PRUint16                 start_central_dir;
	PRUint16                 total_entries_disk;
	PRUint16                 total_entries_archive;
	PRUint32                 central_dir_size;
	PRUint32                 offset_central_dir;
	PRUint16                 commentfield_len;
};

struct ZipCentralHdr
{
	PRUint32                 signature;
	PRUint16                 version_made_by;
	PRUint16                 version;
	PRUint16                 bitflag;
	PRUint16                 method;
	PRUint16                 time;
	PRUint16                 date;
	PRUint32                 crc32;
	PRUint32                 size;
	PRUint32                 orglen;
	PRUint16                 filename_len;
	PRUint16                 extrafield_len;
	PRUint16                 commentfield_len;
	PRUint16                 diskstart_number;
	PRUint16                 internal_attributes;
	PRUint32                 external_attributes;
	PRUint32                 localhdr_offset;
};

struct ZipLocalHdr
{
	PRUint32                 signature;
	PRUint16                 version;
	PRUint16                 bitflag;
	PRUint16                 method;
	PRUint16                 time;
	PRUint16                 date;
	PRUint32                 CRC32;
	PRUint32                 size;
	PRUint32                 orglen;
	PRUint16                 filename_len;
	PRUint16                 extrafield_len;
};

struct ZipDataDesc
{
	PRUint32                 CRC32;
	PRUint32                 size;
	PRUint32                 orglen;
};

#pragma pack(pop)

/* signatures */
#define LOCALSIG    0x04034B50l
#define CENTRALSIG  0x02014B50l
#define ENDSIG      0x06054B50l

/* compression methods */
#define STORED            0
#define SHRUNK            1
#define REDUCED1          2
#define REDUCED2          3
#define REDUCED3          4
#define REDUCED4          5
#define IMPLODED          6
#define TOKENIZED         7
#define DEFLATED          8

#endif
